package pluginDeMiseEnForme;

import graph.Tableur;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import compatibilite.AExcelMiniControleur;
import compatibilite.AExcelMiniModele;
import compatibilite.AExcelMiniPlugin;
import compatibilite.AExcelMiniVue;

/***************
 * 
 * @author Robin
 *
 */
public class PluginMiseEnForme extends AExcelMiniPlugin
{
	JPanel affichage;
	
	public PluginMiseEnForme() 
	{
		
	}
	
	@Override
	public void initialiser(JPanel affichage) 
	{
		this.vuePlugin = new VueMiseEnForme();
		vuePlugin.installerUI(affichage);
		this.modeleBase = new ModeleMiseEnForme();
		this.controleurGeneral = new ControleurMiseEnForme();
		configurerControleurGeneral(modeleBase);
		vuePlugin.setControleur(controleurGeneral);
	}
	
	@Override
	public void initialiser(AExcelMiniModele modele,AExcelMiniVue vue, AExcelMiniControleur controleur,JPanel affichage)
	{
		this.vuePlugin = vue;
		vue.installerUI(affichage);
		this.modeleBase = modele;
		this.controleurGeneral = controleur;
		configurerControleurGeneral(modele);
		vuePlugin.setControleur(controleur);
	}
	
	public static void main(String[] args) 
	{
		JFrame fen = new JFrame();
		JPanel panel = new JPanel();
		fen.add(panel, BorderLayout.CENTER);
		PluginMiseEnForme pmef = new PluginMiseEnForme();
		pmef.initialiser(panel);
		pmef.chargerTableBase(new Tableur());
		fen.pack();
		fen.setVisible(true);
	}

	@Override
	public void chargerTableBase(Tableur tableur) 
	{
		this.modeleBase.charger(tableur);
	}
}
